#if !defined(SM__TOUCHABLEOBJECT_H)
#define SM__TOUCHABLEOBJECT_H

#include <vector>
#include <map>
#include <string>
// for enum
#include "swagme.h"

// TODO: TO_NEAR seems to know that cells are 12x12
#define TO_NEAR (3 * 12)
class Sprite;
class Game;

struct rectf {
  double x;
  double y;
  double w;
  double h;
};

// this is no longer an interface class only, it contains the bounding
// box of the touchable object in the game world (not necessarily the
// same as the bounding box of the sprite on the screen)
class TouchableObject {
protected:
  rectf box;
  vector<string> mActiveEffects;
  typedef vector<string>::iterator ActiveEffectIter;
public:
  virtual int Draw(SDL_Surface *dst, bool bShadow) = 0;
  virtual int AddEffect(const string &name) = 0;
  virtual int RemoveEffect(const string &name) = 0;
  virtual sm_cd_object getObjectType() const = 0;

  const rectf& getBox() const { return box; }
  double getLeft() const { return box.x; }
  double getTop() const { return box.y; }
  double getWidth() const { return box.w; }
  double getHeight() const { return box.h; }
  double getRight() const { return (box.x + box.w - 1.0); }
  double getBottom() const { return (box.y + box.h - 1.0); }

  double GetX() const { return box.x; }
  void SetX(double _x) { box.x = _x; }

  double GetY() const { return box.y; }
  void SetY(double _y) { box.y = _y; }

  const bool isNear(const TouchableObject *touchable);
  const bool isNear(const TouchableObject *touchable, const int nearness);

  TouchableObject();
  TouchableObject(int left, int top, int width, int height);
  virtual ~TouchableObject() {}

  virtual void Update(Game*, Uint32 prevTick, Uint32 thisTick) = 0;

  std::string sObjName;
};

class DummyWall : public TouchableObject {
    // interface function at TouchableObject
    int Draw(SDL_Surface *dst, bool bShadow) { return 0; }
    int AddEffect(const string &name) { return 0; }
    int RemoveEffect(const string &name) { return 0; }
    sm_cd_object getObjectType() const { return sm_cdo_wall; }

    void Update(Game*, Uint32 prevTick, Uint32 thisTick) {}
};

#endif // SM__TOUCHABLEOBJECT_H
